Xbasic

zip_folder Function

Syntax

L result = zip_folder(c zipFilename, c folder [, c filter_in [, c filter_out]])

Arguments

zipFilenameCharacter

The name of the zip file to create.

folderCharacter

The folder to zip

includeFilterCharacter

Default = "". A comma delimited list of files to include. Wildcard characters can be used to specify files to include. File names must be relative to the specified folder. An empty string indicates all files should be included.

Wildcard
Description
*

Match any sequence of characters

?

Match any single character

excludeFilterCharacter

Default = "". A comma delimited list of files to exclude. Wildcard characters can be used to specify files to exclude. File names must be relative to the folder that is specified. An empty string indicates that no files should be excluded.

See includeFilter above for more info about wildcards.

Returns

resultLogical

Returns .t. if the operation was successful. Otherwise, returns .f..

Description

Zips all of the files in a folder.

Discussion

The zip_folder() function creates a zip archive of the files in a folder. Optional filters can be specified that explicitly include or exclude files in the directory.

Example

' zip all of the files in the c:\myfiles folder
dim flag as l
flag = zip_folder("c:\mydata\zi1.zip","c:\myfiles")

' zip all of the files in the c:\myfiles folder, but exclude the subfolder\file1.pdf file.
flag = zip_folder("c:\mydata\zi1.zip","c:\myfiles","","subfolder\fil1.pdf")

See Also